package eme.android;

	import android.content.Context;
	import android.graphics.Canvas;
import android.graphics.Color;
	import android.graphics.Paint;
import android.view.View;

	public class SettingsView extends View{
		
		Main main;
		Paint p = new Paint();
		float width, height;
		float large, medium, notsosmall, small, verysmall;
		float topRow, midRow, botRow, leftCol, midCol, riteCol;

		public SettingsView(Context context) {
			super(context);
			
			//Connect to parameter.
			this.main = (Main) context;
			p.setAntiAlias(true);
			
			//Log.d(TAG,"Constructed.");
		}
		@Override
	    public void onDraw(Canvas canvas) {
	    	super.onDraw(canvas);
	   	
	   		if(main.bIsPortrait){
	 			drawPortrait(canvas);
			} else {
	  			drawLandscape(canvas);
			}
		}
		void drawPortrait(Canvas canvas) {
			
			//Get screen size (physical height minus height of status and title bar).
			height = this.getHeight();
			width = this.getWidth();
			
			//Standard text sizes.
			large = Math.min(0.500f*height,0.670f*width);
			medium = Math.min(0.062f*height,0.082f*width);
			notsosmall = Math.min(0.042f*height,0.056f*width);
			small = Math.min(0.030f*height,0.040f*width);
			verysmall = Math.min(0.020f*height,0.027f*width);

			//Standard positions.
			topRow = 0.100f*height;
			midRow = 0.530f*height;
			botRow = 0.920f*height;
			leftCol = 0.180f*width;
			midCol = 0.500f*width;
			riteCol = 0.820f*width;

			p.setColor(0xffff7711);
			canvas.drawCircle(midCol + 50f*((float) Math.random()), midRow, small, p);
			p.setColor(Color.WHITE);
			canvas.drawLine(leftCol,midRow,riteCol,midRow,p);
					
	    }
		
		
	    
	    
	    void drawLandscape(Canvas canvas){
			
	    	//Get screen size (physical minus height of status and title bars).
			width = this.getWidth();
			height = this.getHeight();

			//Standard text sizes.
			large = Math.min(0.685f*height, 0.400f*width);
			medium = Math.min(0.094f*height, 0.053f*width);
			notsosmall = Math.min(0.075f*height, 0.042f*width);
			small = Math.min(0.044f*height, 0.025f*width);
			verysmall = Math.min(0.031f*height, 0.018f*width);

			//Standard positions.
			topRow = 0.100f*height;
			midRow = 0.500f*height;
			botRow = 0.900f*height;
			leftCol = 0.150f*width;
			midCol = 0.500f*width;
			riteCol = 0.850f*width;

			p.setColor(0xffff7711);
			canvas.drawCircle(midCol, midRow, small, p);
			p.setColor(Color.RED);
			canvas.drawLine(leftCol,midRow,riteCol,midRow,p);
	    }

		
	}
